import type LoginForm from '@/types/LoginForm'
import requestMock from '@/utils/requestMock'
import type RegisterForm from '@/types/RegisterForm'

// 登录
export async function login (form: LoginForm) {
  return await requestMock(() => {
    if (form.username === 'admin' && form.password === '123456') {
      return {msg: 'ok'}
    }
    return {msg: '用户名或密码错误'}
  })
}

// 注册
export async function register(form:RegisterForm) {
  return await requestMock(() => {
    if (form.username && form.password && form.email && form.code === '1234') {
      return {msg: 'ok'}
    }
    return {msg: '注册信息错误'}
  })
}